\hypertarget{motherboard_2usart_8c}{
\section{motherboard/usart.c File Reference}
\label{motherboard_2usart_8c}\index{motherboard/usart.c@{motherboard/usart.c}}
}
Motherboard USART routines.  


{\tt \#include $<$avr/io.h$>$}\par
{\tt \#include $<$avr/interrupt.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$string.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
unsigned char \hyperlink{motherboard_2usart_8c_e16b326eb2d237f0e2e6365254fb7387}{usart1\_\-transmit} (char data)
\begin{CompactList}\small\item\em Send a character to the USART Send a single character to the USART used for the communication bus. \item\end{CompactList}\item 
void \hyperlink{motherboard_2usart_8c_482841a880dc7de7f575b6d2f6297b39}{usart0\_\-init} (unsigned int baudrate)
\begin{CompactList}\small\item\em Initiliaze the USART for the communication bus This function is used to initialize the USART which a baudrate that needs to be sent in as a parameter Use the baudrate settings specified in the ATMEGA128 baudrate setting. \item\end{CompactList}\item 
unsigned char \hyperlink{motherboard_2usart_8c_3475971f83842896fbc0cc8dc107e6cc}{usart0\_\-transmit} (char data)
\begin{CompactList}\small\item\em Send a character to the USART Send a single character to the USART used for the communication bus. \item\end{CompactList}\item 
unsigned char \hyperlink{motherboard_2usart_8c_112a22f41602b42bacbdb0ffac04a59e}{usart0\_\-sendstring} (char $\ast$data, unsigned char length)
\begin{CompactList}\small\item\em Send a string of characters to the USART Send a string of characters to the USART used for the communication bus. \item\end{CompactList}\item 
unsigned char \hyperlink{motherboard_2usart_8c_3d365b96b6297b6163936bdcffc7f008}{usart0\_\-receive} (void)
\begin{CompactList}\small\item\em Retrieve one character from the USART Retrieve one character from the USART. This function will wait until there is a character in the USART RX buffer. \item\end{CompactList}\item 
unsigned char \hyperlink{motherboard_2usart_8c_a397c495b75a8bbfba1128f73a3982c7}{usart0\_\-receive\_\-loopback} (void)
\begin{CompactList}\small\item\em The USART recieve loopback This function does wait for a character in the RX buffer and returns it to the transmit buffer. \item\end{CompactList}\item 
unsigned char \hyperlink{motherboard_2usart_8c_4d13995e1d38d3f790237fa5ca309737}{poll\_\-usart0\_\-receive} (void)
\begin{CompactList}\small\item\em Retrieve one character from the USART Retrieve one character from the USART. With this function you will need to poll the USART, it does NOT wait until a character is in the buffer. \item\end{CompactList}\item 
void \hyperlink{motherboard_2usart_8c_bbe97057bc5a47d8b3c5f4c5a9993b35}{usart1\_\-init} (unsigned int baudrate)
\begin{CompactList}\small\item\em Initiliaze the USART for the communication bus This function is used to initialize the USART which a baudrate that needs to be sent in as a parameter Use the baudrate settings specified in the ATMEGA128 baudrate setting. \item\end{CompactList}\item 
unsigned char \hyperlink{motherboard_2usart_8c_2dc2350f52fc5e6d4579f6e24f477ab2}{usart1\_\-sendstring} (char $\ast$data, unsigned char length)
\begin{CompactList}\small\item\em Send a string of characters to the USART Send a string of characters to the USART used for the communication bus. \item\end{CompactList}\item 
unsigned char \hyperlink{motherboard_2usart_8c_ef7249709ccfaf69979236bc31c3b184}{usart1\_\-receive} (void)
\begin{CompactList}\small\item\em Retrieve one character from the USART Retrieve one character from the USART. This function will wait until there is a character in the USART RX buffer. \item\end{CompactList}\item 
unsigned char \hyperlink{motherboard_2usart_8c_86add9375c019696ca7631ee20f2d6d6}{usart1\_\-receive\_\-loopback} (void)
\begin{CompactList}\small\item\em The USART recieve loopback This function does wait for a character in the RX buffer and returns it to the transmit buffer. \item\end{CompactList}\item 
unsigned char \hyperlink{motherboard_2usart_8c_b1455e6900de4811aed2ae872667e154}{poll\_\-usart1\_\-receive} (void)
\begin{CompactList}\small\item\em Retrieve one character from the USART Retrieve one character from the USART. With this function you will need to poll the USART, it does NOT wait until a character is in the buffer. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Motherboard USART routines. 

\begin{Desc}
\item[Author:]Mikael Larsmark, SM2WMV \end{Desc}
\begin{Desc}
\item[Date:]2010-01-25 

\begin{Code}\begin{verbatim} #include "motherboard/usart.c" 
\end{verbatim}
\end{Code}

 \end{Desc}


Definition in file \hyperlink{motherboard_2usart_8c-source}{usart.c}.

\subsection{Function Documentation}
\hypertarget{motherboard_2usart_8c_4d13995e1d38d3f790237fa5ca309737}{
\index{motherboard/usart.c@{motherboard/usart.c}!poll\_\-usart0\_\-receive@{poll\_\-usart0\_\-receive}}
\index{poll\_\-usart0\_\-receive@{poll\_\-usart0\_\-receive}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{poll\_\-usart0\_\-receive}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char poll\_\-usart0\_\-receive (void)}}
\label{motherboard_2usart_8c_4d13995e1d38d3f790237fa5ca309737}


Retrieve one character from the USART Retrieve one character from the USART. With this function you will need to poll the USART, it does NOT wait until a character is in the buffer. 

Retrieve one character from the USART0 Retrieve one character from the USART. With this function you will need to poll the USART, it does NOT wait until a character is in the buffer.

\begin{Desc}
\item[Returns:]The character from the RX USART buffer \end{Desc}


Definition at line 101 of file usart.c.\hypertarget{motherboard_2usart_8c_b1455e6900de4811aed2ae872667e154}{
\index{motherboard/usart.c@{motherboard/usart.c}!poll\_\-usart1\_\-receive@{poll\_\-usart1\_\-receive}}
\index{poll\_\-usart1\_\-receive@{poll\_\-usart1\_\-receive}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{poll\_\-usart1\_\-receive}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char poll\_\-usart1\_\-receive (void)}}
\label{motherboard_2usart_8c_b1455e6900de4811aed2ae872667e154}


Retrieve one character from the USART Retrieve one character from the USART. With this function you will need to poll the USART, it does NOT wait until a character is in the buffer. 

Retrieve one character from the USART1 Retrieve one character from the USART. With this function you will need to poll the USART, it does NOT wait until a character is in the buffer.

\begin{Desc}
\item[Returns:]The character from the RX USART buffer \end{Desc}


Definition at line 179 of file usart.c.\hypertarget{motherboard_2usart_8c_482841a880dc7de7f575b6d2f6297b39}{
\index{motherboard/usart.c@{motherboard/usart.c}!usart0\_\-init@{usart0\_\-init}}
\index{usart0\_\-init@{usart0\_\-init}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{usart0\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}void usart0\_\-init (unsigned int {\em baudrate})}}
\label{motherboard_2usart_8c_482841a880dc7de7f575b6d2f6297b39}


Initiliaze the USART for the communication bus This function is used to initialize the USART which a baudrate that needs to be sent in as a parameter Use the baudrate settings specified in the ATMEGA128 baudrate setting. 

Initiliaze the USART0 for the communication bus This function is used to initialize the USART which a baudrate that needs to be sent in as a parameter Use the baudrate settings specified in the ATMEGA2560 baudrate setting.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em baud}]The baudrate param from the ATMEGA32 datasheet. \end{description}
\end{Desc}


Definition at line 34 of file usart.c.\hypertarget{motherboard_2usart_8c_3d365b96b6297b6163936bdcffc7f008}{
\index{motherboard/usart.c@{motherboard/usart.c}!usart0\_\-receive@{usart0\_\-receive}}
\index{usart0\_\-receive@{usart0\_\-receive}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{usart0\_\-receive}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char usart0\_\-receive (void)}}
\label{motherboard_2usart_8c_3d365b96b6297b6163936bdcffc7f008}


Retrieve one character from the USART Retrieve one character from the USART. This function will wait until there is a character in the USART RX buffer. 

Retrieve one character from the USART0 Retrieve one character from the USART. This function will wait until there is a character in the USART RX buffer.

\begin{Desc}
\item[Returns:]The character from the RX USART buffer \end{Desc}


Definition at line 74 of file usart.c.\hypertarget{motherboard_2usart_8c_a397c495b75a8bbfba1128f73a3982c7}{
\index{motherboard/usart.c@{motherboard/usart.c}!usart0\_\-receive\_\-loopback@{usart0\_\-receive\_\-loopback}}
\index{usart0\_\-receive\_\-loopback@{usart0\_\-receive\_\-loopback}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{usart0\_\-receive\_\-loopback}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char usart0\_\-receive\_\-loopback (void)}}
\label{motherboard_2usart_8c_a397c495b75a8bbfba1128f73a3982c7}


The USART recieve loopback This function does wait for a character in the RX buffer and returns it to the transmit buffer. 

The USART0 recieve loopback This function does wait for a character in the RX buffer and returns it to the transmit buffer.

\begin{Desc}
\item[Returns:]The character from the RX USART buffer \end{Desc}


Definition at line 86 of file usart.c.

References usart0\_\-transmit().\hypertarget{motherboard_2usart_8c_112a22f41602b42bacbdb0ffac04a59e}{
\index{motherboard/usart.c@{motherboard/usart.c}!usart0\_\-sendstring@{usart0\_\-sendstring}}
\index{usart0\_\-sendstring@{usart0\_\-sendstring}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{usart0\_\-sendstring}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char usart0\_\-sendstring (char $\ast$ {\em data}, \/  unsigned char {\em length})}}
\label{motherboard_2usart_8c_112a22f41602b42bacbdb0ffac04a59e}


Send a string of characters to the USART Send a string of characters to the USART used for the communication bus. 

Send a string of characters to the USART0 Send a string of characters to the USART used for the communication bus.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]The string of characters you wish to send \item[{\em length}]The length of the string you wish to send \end{description}
\end{Desc}


Definition at line 61 of file usart.c.

References usart0\_\-transmit().\hypertarget{motherboard_2usart_8c_3475971f83842896fbc0cc8dc107e6cc}{
\index{motherboard/usart.c@{motherboard/usart.c}!usart0\_\-transmit@{usart0\_\-transmit}}
\index{usart0\_\-transmit@{usart0\_\-transmit}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{usart0\_\-transmit}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char usart0\_\-transmit (char {\em data})}}
\label{motherboard_2usart_8c_3475971f83842896fbc0cc8dc107e6cc}


Send a character to the USART Send a single character to the USART used for the communication bus. 

Send a character to the USART0 Send a single character to the USART used for the communication bus.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]The character you want to send \end{description}
\end{Desc}


Definition at line 48 of file usart.c.\hypertarget{motherboard_2usart_8c_bbe97057bc5a47d8b3c5f4c5a9993b35}{
\index{motherboard/usart.c@{motherboard/usart.c}!usart1\_\-init@{usart1\_\-init}}
\index{usart1\_\-init@{usart1\_\-init}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{usart1\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}void usart1\_\-init (unsigned int {\em baudrate})}}
\label{motherboard_2usart_8c_bbe97057bc5a47d8b3c5f4c5a9993b35}


Initiliaze the USART for the communication bus This function is used to initialize the USART which a baudrate that needs to be sent in as a parameter Use the baudrate settings specified in the ATMEGA128 baudrate setting. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em baudrate}]The baudrate param from the ATMEGA32 datasheet. \end{description}
\end{Desc}


Definition at line 112 of file usart.c.\hypertarget{motherboard_2usart_8c_ef7249709ccfaf69979236bc31c3b184}{
\index{motherboard/usart.c@{motherboard/usart.c}!usart1\_\-receive@{usart1\_\-receive}}
\index{usart1\_\-receive@{usart1\_\-receive}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{usart1\_\-receive}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char usart1\_\-receive (void)}}
\label{motherboard_2usart_8c_ef7249709ccfaf69979236bc31c3b184}


Retrieve one character from the USART Retrieve one character from the USART. This function will wait until there is a character in the USART RX buffer. 

Retrieve one character from the USART1 Retrieve one character from the USART. This function will wait until there is a character in the USART RX buffer.

\begin{Desc}
\item[Returns:]The character from the RX USART buffer \end{Desc}


Definition at line 152 of file usart.c.\hypertarget{motherboard_2usart_8c_86add9375c019696ca7631ee20f2d6d6}{
\index{motherboard/usart.c@{motherboard/usart.c}!usart1\_\-receive\_\-loopback@{usart1\_\-receive\_\-loopback}}
\index{usart1\_\-receive\_\-loopback@{usart1\_\-receive\_\-loopback}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{usart1\_\-receive\_\-loopback}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char usart1\_\-receive\_\-loopback (void)}}
\label{motherboard_2usart_8c_86add9375c019696ca7631ee20f2d6d6}


The USART recieve loopback This function does wait for a character in the RX buffer and returns it to the transmit buffer. 

The USART1 recieve loopback This function does wait for a character in the RX buffer and returns it to the transmit buffer.

\begin{Desc}
\item[Returns:]The character from the RX USART buffer \end{Desc}


Definition at line 164 of file usart.c.

References usart0\_\-transmit(), and usart1\_\-transmit().\hypertarget{motherboard_2usart_8c_2dc2350f52fc5e6d4579f6e24f477ab2}{
\index{motherboard/usart.c@{motherboard/usart.c}!usart1\_\-sendstring@{usart1\_\-sendstring}}
\index{usart1\_\-sendstring@{usart1\_\-sendstring}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{usart1\_\-sendstring}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char usart1\_\-sendstring (char $\ast$ {\em data}, \/  unsigned char {\em length})}}
\label{motherboard_2usart_8c_2dc2350f52fc5e6d4579f6e24f477ab2}


Send a string of characters to the USART Send a string of characters to the USART used for the communication bus. 

Send a string of characters to the USART1 Send a string of characters to the USART used for the communication bus.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]The string of characters you wish to send \item[{\em length}]The length of the string you wish to send \end{description}
\end{Desc}


Definition at line 139 of file usart.c.

References usart1\_\-transmit().\hypertarget{motherboard_2usart_8c_e16b326eb2d237f0e2e6365254fb7387}{
\index{motherboard/usart.c@{motherboard/usart.c}!usart1\_\-transmit@{usart1\_\-transmit}}
\index{usart1\_\-transmit@{usart1\_\-transmit}!motherboard/usart.c@{motherboard/usart.c}}
\subsubsection[{usart1\_\-transmit}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char usart1\_\-transmit (char {\em data})}}
\label{motherboard_2usart_8c_e16b326eb2d237f0e2e6365254fb7387}


Send a character to the USART Send a single character to the USART used for the communication bus. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]The character you want to send\end{description}
\end{Desc}
Send a character to the USART Send a single character to the USART used for the communication bus.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]The character you want to send \end{description}
\end{Desc}


Definition at line 132 of file usart.c.

Referenced by computer\_\-interface\_\-send\_\-data(), init\_\-usart\_\-computer(), ISR(), main(), usart1\_\-receive\_\-loopback(), and usart1\_\-sendstring().